package response

import (
	"github.com/gin-gonic/gin"
)

type JsonStruct struct {
	Code int         `json:"code"`
	Msg  interface{} `json:"msg"`
	Data interface{} `json:"data"`
}

func Success(context *gin.Context, data any, msg string) {
	json := &JsonStruct{
		Code: 200,
		Msg:  msg,
		Data: data,
	}
	context.JSON(200, json)
}

func Fail(context *gin.Context, code int, msg string, data any) {
	json := &JsonStruct{
		Code: code,
		Msg:  msg,
		Data: data,
	}
	context.JSON(200, json)
}
